- issuable = local_assigns.fetch(:issuable)
- project = local_assigns.fetch(:project)

- return unless issuable.is_a?(MergeRequest)
- return if issuable.closed_or_merged_without_fork?

.form-group.row.gl-mb-7
  .col-12
    %label
      = _('Merge options')
    - if issuable.can_remove_source_branch?(current_user)
      .form-check.gl-pl-0
        = hidden_field_tag 'merge_request[force_remove_source_branch]', '0', id: nil
        = render Pajamas::CheckboxTagComponent.new(name: 'merge_request[force_remove_source_branch]', checked: issuable.force_remove_source_branch?, value: '1', checkbox_options: { class: 'js-form-update' }) do |c|
          - c.with_label do
            = _("Delete source branch when merge request is accepted.")

    - if !project.squash_never?
      .form-check.gl-pl-0
        - if project.squash_always?
          = hidden_field_tag 'merge_request[squash]', '1', id: nil
          = render Pajamas::CheckboxTagComponent.new(name: 'merge_request[squash]', checked: project.squash_enabled_by_default?, value: '1', checkbox_options: { class: 'js-form-update', disabled: true }) do |c|
            - c.with_label do
              = _("Squash commits when merge request is accepted.")
              = link_to sprite_icon('question-o'), help_page_path('user/project/merge_requests/squash_and_merge'), target: '_blank', rel: 'noopener noreferrer'
            - c.with_help_text do
              = _('Required in this project.')
        - else
          = hidden_field_tag 'merge_request[squash]', '0', id: nil
          = render Pajamas::CheckboxTagComponent.new(name: 'merge_request[squash]', checked: issuable_squash_option?(issuable, project), value: '1', checkbox_options: { class: 'js-form-update' }) do |c|
            - c.with_label do
              = _("Squash commits when merge request is accepted.")
              = link_to sprite_icon('question-o'), help_page_path('user/project/merge_requests/squash_and_merge'), target: '_blank', rel: 'noopener noreferrer'
